package com.dbzf.utils;

public class PageUtil {
    private Integer totalCounts;
    private Integer totalPages;
    private Integer currentPage;
    private Integer pageSize;

    public Integer getTotalCounts() {
        return totalCounts;
    }

    public void setTotalCounts(Integer totalCounts) {
        this.totalCounts = totalCounts;
    }

    public Integer getTotalPages() {
        return totalPages;
    }

    public void setTotalPages() {
        if (totalCounts % pageSize == 0) {
            totalPages = totalCounts / pageSize;
        } else {
            totalPages = (totalCounts / pageSize) + 1;
        }
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    @Override
    public String toString() {
        return "PageUtil{" +
                "totalCounts=" + totalCounts +
                ", totalPages=" + totalPages +
                ", currentPage=" + currentPage +
                ", pageSize=" + pageSize +
                '}';
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
